🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / service / src / androidHostTest / kotlin / org / meshtastic / core / service / MeshServiceNotificationsImplTest.kt
Displaying Raw • Download
core/service/src/androidHostTest/kotlin/org/meshtastic/core/service/MeshServiceNotificationsImplTest.kt renovate/net.java.dev.jna-jna-5.x (5a8f4966) Text, 4.05 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.service
Tff7b72import T7ee787android.app.NotificationChannel
Tff7b72import T7ee787android.app.NotificationManager
Tff7b72import T7ee787android.content.Context
Tff7b72import T7ee787androidx.test.core.app.ApplicationProvider
Tff7b72import T7ee787androidx.test.ext.junit.runners.AndroidJUnit4
Tff7b72import T7ee787org.junit.After
Tff7b72import T7ee787org.junit.Before
Tff7b72import T7ee787org.junit.Test
Tff7b72import T7ee787org.junit.runner.RunWith
Tff7b72import T7ee787org.meshtastic.core.repository.NodeRepository
Tff7b72import T7ee787org.meshtastic.core.repository.PacketRepository
Tff7b72import T7ee787org.robolectric.annotation.Config
Tff7b72import T7ee787kotlin.test.assertNotNull
Tff7b72import T7ee787kotlin.test.assertNull
Tf0883e@RunWithTb4b4b4(Te6edf3AndroidJUnit4Tff7b72::Te6edf3classTb4b4b4)
Tf0883e@ConfigTb4b4b4(Te6edf3sdk Tff7b72= Tff7b72[T79c0ff3T79c0ff4Tff7b72]Tb4b4b4)
Tff7b72class T56d364MeshServiceNotificationsImplTest Tb4b4b4{
Tff7b72private Tff7b72lateinit Tff7b72var Te6edf3contextTb4b4b4: Te6edf3Context
Tff7b72private Tff7b72lateinit Tff7b72var Te6edf3systemNotificationManagerTb4b4b4: Te6edf3NotificationManager
Tf0883e@Before
Tff7b72fun Td2a8ffsetUpTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3context Tff7b72= Te6edf3ApplicationProviderTb4b4b4.Te6edf3getApplicationContextTb4b4b4(Tb4b4b4)
Te6edf3systemNotificationManager Tff7b72= Te6edf3contextTb4b4b4.Te6edf3getSystemServiceTb4b4b4(Te6edf3NotificationManagerTff7b72::Te6edf3classTb4b4b4.Te6edf3javaTb4b4b4)Tff7b72!!
Te6edf3clearManagedChannelsTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tf0883e@After
Tff7b72fun Td2a8fftearDownTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3clearManagedChannelsTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`initChannels removes legacy categories and creates canonical channels`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LEGACY_CATEGORY_IDSTb4b4b4.Te6edf3forEachTb4b4b4(Tff7b72::Te6edf3createChannelTb4b4b4)
Tff7b72val Te6edf3notifications Tff7b72=
Te6edf3MeshServiceNotificationsImplTb4b4b4(
Te6edf3context Tff7b72= Te6edf3contextTb4b4b4,
Te6edf3packetRepository Tff7b72= Te6edf3lazyTff7b72<Te6edf3PacketRepositoryTff7b72> Tb4b4b4{ Te6edf3errorTb4b4b4(Ta5d6ff"Ta5d6ffNot used in this testTa5d6ff"Tb4b4b4) Tb4b4b4}Tb4b4b4,
Te6edf3nodeRepository Tff7b72= Te6edf3lazyTff7b72<Te6edf3NodeRepositoryTff7b72> Tb4b4b4{ Te6edf3errorTb4b4b4(Ta5d6ff"Ta5d6ffNot used in this testTa5d6ff"Tb4b4b4) Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Te6edf3notificationsTb4b4b4.Te6edf3initChannelsTb4b4b4(Tb4b4b4)
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LEGACY_CATEGORY_IDSTb4b4b4.Te6edf3forEach Tb4b4b4{ Te6edf3legacyId Tff7b72-Tff7b72>
Te6edf3assertNullTb4b4b4(Te6edf3systemNotificationManagerTb4b4b4.Te6edf3getNotificationChannelTb4b4b4(Te6edf3legacyIdTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tff7b72val Te6edf3canonicalChannelIds Tff7b72=
Te6edf3listOfTb4b4b4(
Te6edf3NotificationChannelsTb4b4b4.Te6edf3SERVICETb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3MESSAGESTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3BROADCASTSTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3WAYPOINTSTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3ALERTSTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3NEW_NODESTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LOW_BATTERYTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LOW_BATTERY_REMOTETb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3CLIENTTb4b4b4,
Tb4b4b4)
Te6edf3canonicalChannelIdsTb4b4b4.Te6edf3forEach Tb4b4b4{ Te6edf3channelId Tff7b72-Tff7b72>
Te6edf3assertNotNullTb4b4b4(Te6edf3systemNotificationManagerTb4b4b4.Te6edf3getNotificationChannelTb4b4b4(Te6edf3channelIdTb4b4b4)Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72private Tff7b72fun Td2a8ffcreateChannelTb4b4b4(Te6edf3idTb4b4b4: Tffa657StringTb4b4b4) Tb4b4b4{
Te6edf3systemNotificationManagerTb4b4b4.Te6edf3createNotificationChannelTb4b4b4(
Te6edf3NotificationChannelTb4b4b4(Te6edf3idTb4b4b4, Te6edf3idTb4b4b4, Te6edf3NotificationManagerTb4b4b4.Te6edf3IMPORTANCE_DEFAULTTb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tff7b72private Tff7b72fun Td2a8ffclearManagedChannelsTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3channelIds Tff7b72=
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LEGACY_CATEGORY_IDS Tff7b72+
Te6edf3listOfTb4b4b4(
Te6edf3NotificationChannelsTb4b4b4.Te6edf3SERVICETb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3MESSAGESTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3BROADCASTSTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3WAYPOINTSTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3ALERTSTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3NEW_NODESTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LOW_BATTERYTb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3LOW_BATTERY_REMOTETb4b4b4,
Te6edf3NotificationChannelsTb4b4b4.Te6edf3CLIENTTb4b4b4,
Tb4b4b4)
Te6edf3channelIdsTb4b4b4.Te6edf3forEach Tb4b4b4{ Te6edf3channelId Tff7b72-Tff7b72> Te6edf3systemNotificationManagerTb4b4b4.Te6edf3deleteNotificationChannelTb4b4b4(Te6edf3channelIdTb4b4b4) Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.07s